package cn.itcast.hotel.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.data.elasticsearch.annotations.GeoPointField;
import org.springframework.data.elasticsearch.core.geo.GeoPoint;

@Data
@Document( indexName = "hotel", createIndex = true)
@NoArgsConstructor
@AllArgsConstructor
public class HotelDoc2 {
    @Id
    @Field(type = FieldType.Long)
    private Long id;
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String name;
    @Field(type = FieldType.Keyword)
    private String address;
    @Field(type = FieldType.Integer)
    private Integer price;
    @Field(type = FieldType.Integer)
    private Integer score;
    @Field(type = FieldType.Keyword, store = true)
    private String brand;
    @Field(type = FieldType.Keyword, store = true)
    private String city;
    @Field(type = FieldType.Keyword, store = true)
    private String starName;
    @Field(type = FieldType.Keyword, store = true)
    private String business;
    //@Field(type = FieldType.Keyword, index = false)
    @GeoPointField
    private String location;
    @Field(type = FieldType.Keyword, index = false)
    private String pic;

    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String all;

    // 不是文档字段，只是为了方便查询
    @Field(ignoreFields = "true")
    private Object distance;


}